//
//  NewsI004TMWKWebVc.h
//  NewsI004
//
//  Created by mac on 2022/7/19.
//  Copyright © 2022 Summer. All rights reserved.
//

#import <TMSDK/TMSDK.h>
#import <WebKit/WebKit.h>
#import "FCBaseWebViewVc.h"
NS_ASSUME_NONNULL_BEGIN

@interface FCBaseTMWebVc : TMViewController

@property (nonatomic, copy) NSString *share_pic;// js 回调分享图片
//TMViewController无法执行dealloc， 临时处理

@property (nonatomic,strong) WKWebView *wkWebView;  //WKWebView
@property (nonatomic, strong) WKWebViewConfiguration *configuration;
@property (nonatomic,strong) UIProgressView *progress; //进度条

@property (nonatomic, strong) UIButton *backBarButton;   //返回按钮
@property (nonatomic, strong) UIButton *closeBarButton;  //关闭按钮
@property (nonatomic , assign) BOOL canGoBack;//是否可以返回
@property (nonatomic , assign) BOOL canAdGoBack; // 广告取消
@property (nonatomic, strong) UIButton *shareBarButton;   //分享按钮
@property (nonatomic, strong) UIButton *collectBarButton;  //收藏按钮
/**
  willAppear = YES,网页已经loadrequest
  willAppear = NO,网页没有loadrequest

 */
@property (nonatomic, assign) BOOL willAppear;

/**
 webView返回的数据
 */
@property (nonatomic, strong) NSDictionary  *callData;
/**
 设备的uuid
 */
@property (nonatomic, copy) NSString *uuid;
/**
  是否返回两次
 */
@property (nonatomic, assign) BOOL goBackSecond;
/**
 用户ID
 */
@property (nonatomic, assign) NSInteger member_id;

/**
 传过来的数据
 */
@property (nonatomic, strong)  NSDictionary * dic;

/**
 请求的url
 */
@property (nonatomic,copy) NSString *htmlUrl;

/**
 要注入的js方法
 */
@property (nonatomic,copy) NSString *jsString;

/**
 进度条颜色
 */
@property (nonatomic,strong) UIColor *loadingProgressColor;

/**
 是否下拉重新加载
 */
@property (nonatomic, assign) BOOL canDownRefresh;
/// cms  需要拦截跳转的小程序的数组
@property(nonatomic, copy) NSArray * interceptList;

#pragma mark -- public methods

- (void)cancelRecord;
/**
  ViewWillAperar 默认处理方法
 */
- (void)defaultWillAppearFunc;

/**
 ViewWillDisappear 默认处理方法
*/
- (void)defaultWillDisappearFunc;

/**
  第一次 viewWillApper 加载网页
 */
- (void)fisrtViewWillApperLoadRequest;
/**
 设置viewWillApper导航栏状态
 */
- (void)setViewWillAppearNavigationBar;

/**
 设置ViewWillDisappear导航栏状态
 */
- (void)setViewWillDisappearNavigationBar;

/**
  添加设备方向的通知
 */
- (void)addOrientChangeNoti;
/**
 移除设备方向的通知
 */
- (void)removeOrientChangeNoti;

/**
 处理受到设备方向变化的通知
 */

- (void)dealOrientChangeNoti:(NSNotification *)noti;

/**
  开始网页请求
 */
- (void)loadRequest;

/**
  网页重新加载
 */
- (void)wkWebViewReload;

/**
 点击返回
 */
- (void)backAction:(UIButton *)sender;

/**
  点击关闭
 */
- (void)closeAction:(UIButton *)sender;

/**
  点击收藏
 */
- (void)collectAction:(UIButton *)sender;

/**
 点击分享
 */
- (void)shareAction:(UIButton *)sender;


/**
 移除webView所有监听
 */
- (void)removeWebViewAllOberser;

/**
 展示左边button
 */
- (void)showLeftBarButtonItem;

/**
 展示右边button
 */
- (void)showRightBarButtonItem;

#pragma mark -- js action

/**
 处理-informationCallback-js事件
 资讯详情H5页面返回的
 */
- (void)informationCallbackFromWebView:(NSDictionary *)message;

/// h5页码点击分享
/*
 参数:{
     description = "";
     thumbUrl =  ";
     title =
     url =   ;
 }*/
- (void)tmShareCallBackFromWebView:(NSDictionary *)dic;

/// **************** --  音频录制 --  ****************
- (void)tmfcJsStartRecordFromWebView:(NSDictionary *)dic;

- (NSURL*)changeURLSchemeStr:(NSString*)urlStr;

- (void)setupUI;

//给webView添加UserAgent
- (void)addUserAgentToWebView;
 
//  配置 topView 显示 siteHomeLogo
- (void)configNavTopView;
 
- (void)fcWebBrowse:(WKWebView *)webView  navigationAction:(WKNavigationAction *)navigationAction  decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler result:(void (^)(BOOL stop))result;
 
@end

NS_ASSUME_NONNULL_END

